//
//  taskDetailsCVc.m
//  pacc
//
//  Created by 测试 on 2018/5/30.
//  Copyright © 2018年 测试. All rights reserved.
//
typedef void (^ReturnValueBlock) (BOOL strValue);
#import "taskDetailsCVc.h"
#import "yuepianController.h"
#import "ZYInputAlertView.h"
#import "mobanController.h"
@interface taskDetailsCVc ()<UITextViewDelegate>

@property (weak, nonatomic) IBOutlet UIScrollView *myScrollView;
@property (weak, nonatomic) IBOutlet UIView *textViewSuper;
@property (weak, nonatomic) IBOutlet UIButton *typeBtn;
@property (weak, nonatomic) IBOutlet UITextView *appearanceTV;
@property (weak, nonatomic) IBOutlet UITextView *resultTV;
@property (weak, nonatomic) IBOutlet UILabel *shouruLabel;
@property (weak, nonatomic) IBOutlet UIButton *baocunBtn;
@property (weak, nonatomic) IBOutlet UIButton *tijiaoBtn;
@property (weak, nonatomic) IBOutlet UILabel *creatTimeLabel;
@property (weak, nonatomic) IBOutlet UILabel *patientNameLabel;
@property (weak, nonatomic) IBOutlet UILabel *patientSexLabel;
@property (weak, nonatomic) IBOutlet UILabel *patientBuweiLabel;
@property (weak, nonatomic) IBOutlet UILabel *patientPhoneLabel;
@property (weak, nonatomic) IBOutlet UILabel *hospitalNameLabel;
@property (weak, nonatomic) IBOutlet UILabel *patientAgeLabel;
@property (weak, nonatomic) IBOutlet UIImageView *pacImageView;
@property (weak, nonatomic) IBOutlet UIButton *endEdidBtn;
@property (weak, nonatomic) IBOutlet UIButton *endEdidBtn2;
@property (copy, nonatomic)  NSString *reporID;
@property (weak, nonatomic) IBOutlet UILabel *bianhaoLabel;
@property (weak, nonatomic) IBOutlet UILabel *orderNoLabel;
@property(nonatomic,copy)NSString * pacDevice;
@property(nonatomic,copy)NSArray * mobanArr;


@end

@implementation taskDetailsCVc
- (IBAction)yuepian:(id)sender {
    yuepianController *vc = [yuepianController new];
    vc.yuepianURL = _yuepianURL;
    vc.zid = _zid;
    __weak typeof(self) weakSelf = self;
    vc.jianchasuojianStr = _appearanceTV.text;
    vc.zhenduanyijianStr = _resultTV.text;
    if ([_nameStr isEqualToString:@"已接单"]||[_nameStr isEqualToString:@"未通过"]) {
        vc.canYuyin = YES;
    }
    vc.myyuepianBlock = ^(NSString *jianchasuojianStr, NSString *zhenduanyijianStr) {
//        weakSelf.appearanceTV.text = [weakSelf.appearanceTV.text stringByAppendingString:jianchasuojianStr];
//        weakSelf.resultTV.text =  [weakSelf.resultTV.text stringByAppendingString:zhenduanyijianStr];
        weakSelf.appearanceTV.text = jianchasuojianStr;
        weakSelf.resultTV.text =  zhenduanyijianStr;
    };
    [self.navigationController pushViewController:vc animated:YES];
}
- (IBAction)endEdid:(id)sender {
    [self.view endEditing:YES];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"任务详情";
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow:) name:UIKeyboardWillShowNotification object:nil];
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillHidden:) name:UIKeyboardWillHideNotification object:nil];
    _myScrollView.backgroundColor = baseBackgroundColor;
    _textViewSuper.backgroundColor = baseBackgroundColor;
    _baocunBtn.layer.borderColor = baseBlueColor.CGColor;
    _baocunBtn.layer.borderWidth = 1;
    if ([_odrStatus isEqualToString:@"已接单"]||[_odrStatus isEqualToString:@"未通过"]) {
        self.resultTV.userInteractionEnabled = YES;
        self.appearanceTV.userInteractionEnabled = YES;
        _isHidden = NO;
        [self creatNavRightBtn];
    }else{
        self.resultTV.editable = NO;
        self.appearanceTV.editable = NO;
        _isHidden = YES;
    }
    if ([_odrStatus isEqualToString:@"待审核"]) {
        _isHidden = NO;
    }
    [self loadData2];
    [self loadData];
    _baocunBtn.hidden = _tijiaoBtn.hidden =_isHidden;
    if (_odrStatus) {
        [_typeBtn setTitle:_odrStatus forState:UIControlStateNormal];
    }
    
}

#pragma mark --rightBtn--
-(void)creatNavRightBtn{
    UIBarButtonItem * voiceButton= [[UIBarButtonItem alloc]initWithImage:[UIImage imageNamed:@"muban_bai"] style:UIBarButtonItemStylePlain target:self action:@selector(goTomoban)];
    [voiceButton setTintColor:[UIColor whiteColor]];
    [self.navigationItem setRightBarButtonItems:[NSArray arrayWithObjects:voiceButton,nil]];
}
-(void)goTomoban{
    mobanController *vc = [mobanController new];
    vc.jianchasuojianStr = self.appearanceTV.text;
    vc.zhenduanyijianStr = self.resultTV.text;
    NSArray * mobanArr = [[NSUserDefaults standardUserDefaults]objectForKey:@"moban"];
    vc.mubanArr = [mobanArr mutableCopy];
    [self.navigationController pushViewController:vc animated:YES];
}
-(void)getmoban{
    NSMutableDictionary *dic =[NSMutableDictionary dictionary];
    NSString *str =[NSString stringWithFormat:@"danyingmanagertemplateselectByParentId"];
    _nameStr =_odrStatus;
    [dic setValue:@"sys" forKey:@"parentId"];
    [dic setValue:my_AppDelegate.token forKey:@"token"];
    [NetWorking startPOSTRequestWithUrl:str parameters:dic logMes:@"模板" show:NO success:^(NSDictionary *data) {
        NSDictionary *temdic = [data objectForKey:@"data"];
        if ([temdic isEqual:[NSNull null]]) {
            return ;
        }
        if (temdic) {
            self->_mobanArr = [temdic objectForKey:@"childList"];
            [[NSUserDefaults standardUserDefaults]setValue:self->_mobanArr forKey:@"moban"];
            [[NSUserDefaults standardUserDefaults]synchronize];
        }
    } failure:^(NSError *error) {
        
    }];
}

-(void)loadData2{
    NSMutableDictionary *dic =[NSMutableDictionary dictionary];
    NSString *str =[NSString stringWithFormat:@"orderget"];
    _nameStr =@"订单详情";
    
    [dic setValue:_zid forKey:@"orderId"];
    [dic setValue:my_AppDelegate.token forKey:@"token"];
    [NetWorking startPOSTRequestWithUrl:str parameters:dic logMes:_nameStr show:NO success:^(NSDictionary *data) {
        NSDictionary *temdic = [data objectForKey:@"data"];
        self.shouruLabel.text = [NSString stringWithFormat:@"%@", [temdic objectForKey:@"price"]];
        self.patientNameLabel.text = [NSString stringWithFormat:@"%@", [temdic objectForKey:@"patientName"]];
        self.patientSexLabel.text = [NSString stringWithFormat:@"%@", [temdic objectForKey:@"patientSex"]];
        self.patientPhoneLabel.text = [NSString stringWithFormat:@"%@", [temdic objectForKey:@"patientPhone"]];
        self.patientAgeLabel.text= [NSString stringWithFormat:@"%@岁",[ZXToolObj getAge:[NSString stringWithFormat:@"%@", [temdic objectForKey:@"patientAge"]]]];
       self.hospitalNameLabel.text = [NSString stringWithFormat:@"%@", [temdic objectForKey:@"pacFromHos"]];
        self.bianhaoLabel.text = [NSString stringWithFormat:@"%@", [temdic objectForKey:@"orderDesc"]];
        self.orderNoLabel.text = [NSString stringWithFormat:@"%@", [temdic objectForKey:@"orderNo"]];

        self.patientBuweiLabel.text = [NSString stringWithFormat:@"%@", [temdic objectForKey:@"pacPart"]];
        NSString *createTime = [NSString stringWithFormat:@"%@",[temdic objectForKey:@"createTime"] ];
        NSString *odrStatus = [NSString stringWithFormat:@"%@",[temdic objectForKey:@"odrStatus"] ];
        self.pacDevice = [NSString stringWithFormat:@"%@",[temdic objectForKey:@"pacDevice"] ];
        if ([self.pacDevice isEqualToString:@"CT"]) {
            [self.pacImageView setImage:[UIImage imageNamed:@"ct_l"]];
        }else if ([self.pacDevice isEqualToString:@"CR"]){
            [self.pacImageView setImage:[UIImage imageNamed:@"cr_l"]];
        }else if ([self.pacDevice isEqualToString:@"DR"]){
            [self.pacImageView setImage:[UIImage imageNamed:@"dr_l"]];
        }else if ([self.pacDevice isEqualToString:@"DSA"]){
            [self.pacImageView setImage:[UIImage imageNamed:@"dsa_l"]];
        }else if ([self.pacDevice isEqualToString:@"MG"]){
            [self.pacImageView setImage:[UIImage imageNamed:@"mg_l"]];
        }else if ([self.pacDevice isEqualToString:@"MR"]){
            [self.pacImageView setImage:[UIImage imageNamed:@"mr_l"]];
        }else if ([self.pacDevice isEqualToString:@"RF"]){
            [self.pacImageView setImage:[UIImage imageNamed:@"rf_l"]];
        }else if ([self.pacDevice isEqualToString:@"X-Ray"]){
            [self.pacImageView setImage:[UIImage imageNamed:@"X-Ray"]];
        }else{
            [self.pacImageView setImage:[UIImage imageNamed:@"ct_l"]];
        }
        dispatch_async(dispatch_get_main_queue(), ^{
            UIColor * color = RGB(207, 103, 41);
            if ([odrStatus isEqualToString:@"7"]) {
                [self->_typeBtn setTitle:@"已取消" forState:UIControlStateNormal];
                color = RGB(120, 120, 120);
            }else if ([odrStatus isEqualToString:@"2"]){
                [self->_typeBtn setTitle:@"已接单" forState:UIControlStateNormal];
                self.resultTV.userInteractionEnabled = YES;
                self.appearanceTV.userInteractionEnabled = YES;
                color = RGB(207, 103, 41);
                self->_isHidden = NO;
            }else if ([odrStatus isEqualToString:@"3"]){
                [self->_typeBtn setTitle:@"已完工" forState:UIControlStateNormal];
                color = RGB(77, 178, 220);
                self->_isHidden = YES;
            }else if ([odrStatus isEqualToString:@"4"]){
                [self->_typeBtn setTitle:@"已审核" forState:UIControlStateNormal];
                color = RGB(91, 187, 59);
                self->_isHidden = YES;
            }else if ([odrStatus isEqualToString:@"5"]){
                [self->_typeBtn setTitle:@"未通过" forState:UIControlStateNormal];
                self.resultTV.userInteractionEnabled = YES;
                self.appearanceTV.userInteractionEnabled = YES;
                color = RGB(211, 73, 66);
            }else if ([odrStatus isEqualToString:@"6"]){
                [self->_typeBtn setTitle:@"已付款" forState:UIControlStateNormal];
                color = RGB(73, 130, 232);
                self->_isHidden = YES;
            }else if ([odrStatus isEqualToString:@"0"]){
                
            }
            if (self->_type == 8) {
//                [self->_typeBtn setTitle:@"待审核" forState:UIControlStateNormal];
//                color = RGB(207, 103, 41);
                self->_isHidden = NO;
            }
            [self->_typeBtn setBackgroundColor:color];
            self->_baocunBtn.hidden = self->_tijiaoBtn.hidden =self->_isHidden;
            self.creatTimeLabel.text = [ZXToolObj getTimeStringFormtimestamp:createTime];
            NSArray * arr = [temdic objectForKey:@"orderPac"];
            if (arr.count) {
                NSDictionary *dic = arr[0];
                NSString *urlStr = [dic objectForKey:@"pacUrl"];
                self->_yuepianURL = urlStr;
            }
        });
    } failure:^(NSError *error) {
        
    }];
}
-(void)loadData{
    NSMutableDictionary *dic =[NSMutableDictionary dictionary];
    NSString *str =[NSString stringWithFormat:@"reportgetReportByOrder"];
    _nameStr =_odrStatus;
    [dic setValue:_zid forKey:@"orderId"];
    [dic setValue:my_AppDelegate.token forKey:@"token"];
    [NetWorking startPOSTRequestWithUrl:str parameters:dic logMes:@"订单报告" show:NO success:^(NSDictionary *data) {
        NSDictionary *temdic = [data objectForKey:@"data"];
        if ([temdic isEqual:[NSNull null]]) {
            return ;
        }
        if (temdic) {
            self->_reporID = [temdic objectForKey:@"id"];
            NSString *jsonString = [temdic objectForKey:@"report"];
            NSData *jsonData = [jsonString dataUsingEncoding:NSUTF8StringEncoding];
            NSError *err;
            NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:jsonData options:NSJSONReadingMutableContainers error:&err];
            NSString *appearance = [dic objectForKey:@"appearance"];
            NSString *result = [dic objectForKey:@"result"];
            self->_resultTV.text = result;
            self->_appearanceTV.text = appearance;
        }
    } failure:^(NSError *error) {
        
    }];
}

#pragma mark 键盘
/**
 *  键盘将要显示
 *
 *  @param notification 通知
 */
-(void)keyboardWillShow:(NSNotification *)notification
{
    _endEdidBtn.hidden = NO;
    _endEdidBtn2.hidden = NO;
    //这样就拿到了键盘的位置大小信息frame，然后根据frame进行高度处理之类的信息
    CGRect frame = [[[notification userInfo] objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue];
    
//    CGRect scrollViewFrame = self.myScrollView.frame;
//    scrollViewFrame.size.height = self.myScrollView.bounds.size.height + frame.size.height;
//    self.myScrollView.frame = scrollViewFrame;
    NSLog(@"frame显示==%@",NSStringFromCGRect(frame));
    if (_appearanceTV.isFirstResponder) {
        _myScrollView.contentOffset = CGPointMake(0,200);
    }else if (_resultTV.isFirstResponder){
        _myScrollView.contentOffset = CGPointMake(0,360);
    }
    if (ScreenWidth <375) {
        
    }else{
        
    }
    _myScrollView.scrollEnabled = NO;
    if (_isHidden) {
        [self.view endEditing:YES];
    }
}
/**
 *  键盘将要隐藏
 *
 *  @param notification 通知
 */
-(void)keyboardWillHidden:(NSNotification *)notification
{
    _endEdidBtn.hidden = YES;
    _endEdidBtn2.hidden = YES;
        _myScrollView.scrollEnabled = YES;
    CGRect frame = [[[notification userInfo] objectForKey:UIKeyboardFrameEndUserInfoKey] CGRectValue];
    NSLog(@"frame隐藏==%@",NSStringFromCGRect(frame));
//    _myScrollView.contentOffset = CGPointMake(0,  0);
}
-(void)viewWillAppear:(BOOL)animated{
    if (my_AppDelegate.backXQ) {
        _appearanceTV.text = my_AppDelegate.jianchasuojianStr;
        _resultTV.text = my_AppDelegate.zhenduanyijianStr;
    }
        my_AppDelegate.backXQ = NO;
    [self getmoban];
    [SVProgressHUD dismiss];
    switch (_type) {
        case 0:
            _myScrollView.contentSize = CGSizeMake(0, 667+100);
            //已接单
            _nameStr =@"已接单";
            break;
        case 1:
            //已接单
            _myScrollView.contentSize = CGSizeMake(0, 667);
            _nameStr =@"已完工";
            break;
        case 2:
            //已接单
            _nameStr =@"已审核";
            break;
        case 3:
            //已接单
            [_typeBtn setBackgroundColor:[UIColor redColor]];
            _nameStr =@"未通过";
            break;
        case 4:
            //已接单
            _nameStr =@"已付款";
            break;
        case 5:
            //已接单
            break;
         case 8:
            //
//            _nameStr =@"待审核";
            [_baocunBtn setTitle:@"不通过" forState:UIControlStateNormal];
            [_baocunBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
            _baocunBtn.layer.borderWidth = 0;
            [_tijiaoBtn setTitle:@"通过" forState:UIControlStateNormal];
            [_baocunBtn setBackgroundColor:RGB(211, 73, 66)];
            [_tijiaoBtn setBackgroundColor:RGB(91, 187, 59)];

            break;
        default:
            break;
    }
    
}

- (BOOL)textFieldShouldReturn:(UITextField *)textField{
    return [textField resignFirstResponder];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
    [self.view endEditing:YES];
}
-(void)tixing{
    NSLog(@"_resultTV.text===%@------\n_resultTV.text.length====%lu",_resultTV.text,(unsigned long)_resultTV.text.length);
    if (_resultTV.text.length==0) {
        [SVProgressHUD showErrorWithStatus:@"报告内容不能为空"];
        dispatch_after(1.0, dispatch_get_main_queue(), ^{
            [SVProgressHUD dismiss];
        });
        [SVProgressHUD setBackgroundColor:RGB(85, 85, 85)];
        [SVProgressHUD setForegroundColor:[UIColor whiteColor]];
        return;
    }else if(_appearanceTV.text.length==0){
        [SVProgressHUD showErrorWithStatus:@"报告内容不能为空"];
        dispatch_after(1.0, dispatch_get_main_queue(), ^{
            [SVProgressHUD dismiss];
        });
        [SVProgressHUD setBackgroundColor:RGB(85, 85, 85)];
        [SVProgressHUD setForegroundColor:[UIColor whiteColor]];
        return;
    }
}
-(void)tixing2{
    if (_resultTV.text.length||_appearanceTV.text.length) {
        
    }else{
        [SVProgressHUD showErrorWithStatus:@"报告内容不能为空"];
        dispatch_after(1.0, dispatch_get_main_queue(), ^{
            [SVProgressHUD dismiss];
        });
        [SVProgressHUD setBackgroundColor:RGB(85, 85, 85)];
        [SVProgressHUD setForegroundColor:[UIColor whiteColor]];
        return;
    }
}
- (IBAction)preserveClick:(UIButton*)sender {
    [self.view endEditing:YES];
    switch (_type) {
        case 0:case 3:
            //保存报告
            [self baocunbaogao];
            break;
        case 8:
            //保存报告
            [self shenhetuihui];
            break;
        default:
            break;
    }
    
}
-(void)shenhetuihui{
    
//    UIAlertController * alertVC = 
    __weak typeof(self) weakSelf = self;
    
    ZYInputAlertView *alertView = [ZYInputAlertView alertView];
    alertView.placeholder = @"请输入审核意见···";
    [alertView confirmBtnClickBlock:^(NSString *inputString) {
        NSMutableDictionary *dic =[NSMutableDictionary dictionary];
        NSString *str =[NSString stringWithFormat:@"reportputConfirmedReport"];
        NSString *nameStr =@"审核不通过";
        [dic setValue:self->_zid forKey:@"orderId"];
        [dic setValue:self->_reporID forKey:@"reportId"];
        [dic setValue:inputString forKey:@"reviewDesc"];
        [dic setValue:@0 forKey:@"reviewStatus"];
        [dic setValue:my_AppDelegate.token forKey:@"token"];
        [NetWorking startPOSTRequestWithUrl:str parameters:dic logMes:nameStr show:YES success:^(NSDictionary *data) {
            self->_baocunBtn.enabled = YES;
            NSString *status = [NSString stringWithFormat:@"%@", [data objectForKey:@"status"]];
            if ([status isEqualToString:@"200"]) {
                dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
                    [self.navigationController popViewControllerAnimated:YES];
                });
            }
        } failure:^(NSError *error) {
            self->_baocunBtn.enabled = YES;
        }];
    }];
    [alertView show];
}
-(void)baocunbaogao{
    if (_resultTV.text.length==0&&_appearanceTV.text.length==0) {
        [SVProgressHUD showErrorWithStatus:@"报告内容不能都为空"];
        [SVProgressHUD setBackgroundColor:RGB(85, 85, 85)];
        [SVProgressHUD setForegroundColor:[UIColor whiteColor]];
        dispatch_after(1.0, dispatch_get_main_queue(), ^{
//            [SVProgressHUD dismiss];
        });
        return;
    }
    [self.view endEditing:YES];
    NSDictionary* orderInfo = @{@"appearance":_appearanceTV.text,
                                @"result":_resultTV.text};
    _tijiaoBtn.enabled = NO;
    // OC对象转JSON
    NSData* json = [NSJSONSerialization dataWithJSONObject:orderInfo options:NSJSONWritingPrettyPrinted error:nil];
    NSString *jsonString = [[NSString alloc] initWithData:json encoding:NSUTF8StringEncoding];
    NSLog(@"%@",jsonString);
    NSMutableDictionary *dic =[NSMutableDictionary dictionary];
    NSString *str =[NSString stringWithFormat:@"reportsaveReport"];
    NSString *nameStr =@"保存报告";
    [dic setValue:self.zid forKey:@"orderId"];
    [dic setValue:jsonString forKey:@"report"];
    [dic setValue:_reporID forKey:@"id"];
    [dic setValue:my_AppDelegate.token forKey:@"token"];
    
    [NetWorking startPOSTRequestWithUrl:str parameters:dic logMes:nameStr show:NO success:^(NSDictionary *data) {
        self->_tijiaoBtn.enabled = YES;
        NSString *repoidStr = [data objectForKey:@"data"];
        NSString *msg = [data objectForKey:@"msg"];
        NSString *status = [NSString stringWithFormat:@"%@", [data objectForKey:@"status"]];
    if ([status isEqualToString:@"200"]) {
        [SVProgressHUD showSuccessWithStatus:msg];
        [SVProgressHUD setBackgroundColor:RGB(85, 85, 85)];
        [SVProgressHUD setForegroundColor:[UIColor whiteColor]];
        dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
            [SVProgressHUD dismiss];
        });
    }
        self->_reporID = repoidStr;
//        NSLog(@"arr=%@",arr);
    } failure:^(NSError *error) {
        self->_tijiaoBtn.enabled = YES;
    }];
}
- (IBAction)postClick:(UIButton*)sender {
    [self.view endEditing:YES];
    switch (_type) {
        case 0:case 3:
            
            [self tijiaobaogao];
            break;
        case 8:
            [self shenhetongguo];
            break;
        default:
            break;
    }
}
-(void)tijiaobaogao{
    if (_resultTV.text.length==0) {
        [SVProgressHUD showErrorWithStatus:@"报告内容不能为空"];
        [SVProgressHUD setBackgroundColor:RGB(85, 85, 85)];
        [SVProgressHUD setForegroundColor:[UIColor whiteColor]];
        return;
    }else if(_appearanceTV.text.length==0){
        [SVProgressHUD showErrorWithStatus:@"报告内容不能为空"];

        [SVProgressHUD setBackgroundColor:RGB(85, 85, 85)];
        [SVProgressHUD setForegroundColor:[UIColor whiteColor]];
        return;
    }
    [self.view endEditing:YES];
    NSDictionary* orderInfo = @{@"appearance":_appearanceTV.text,
                                @"result":_resultTV.text};
    _tijiaoBtn.enabled = NO;
    // OC对象转JSON
    NSData* json = [NSJSONSerialization dataWithJSONObject:orderInfo options:NSJSONWritingPrettyPrinted error:nil];
    NSString *jsonString = [[NSString alloc] initWithData:json encoding:NSUTF8StringEncoding];
    NSMutableDictionary *dic =[NSMutableDictionary dictionary];
    NSString *str =[NSString stringWithFormat:@"reportputReport"];
    NSString *nameStr =@"提交报告";
    [dic setValue:_zid forKey:@"orderId"];
    [dic setValue:jsonString forKey:@"report"];
    [dic setValue:_reporID forKey:@"id"];
    [dic setValue:my_AppDelegate.token forKey:@"token"];
    
    [NetWorking startPOSTRequestWithUrl:str parameters:dic logMes:nameStr show:NO success:^(NSDictionary *data) {
        NSString *status = [NSString stringWithFormat:@"%@", [data objectForKey:@"status"]];
        if ([status isEqualToString:@"200"]) {
            BOOL inputString = YES;
            __weak typeof(self) weakself = self;
            
            if (weakself.returnValueBlock) {
                weakself.returnValueBlock(inputString);
            }
            NSString *msg = [data objectForKey:@"msg"];

            [SVProgressHUD showSuccessWithStatus:msg];
            [SVProgressHUD setBackgroundColor:RGB(85, 85, 85)];
            [SVProgressHUD setForegroundColor:[UIColor whiteColor]];
            dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
                
                [self.navigationController popViewControllerAnimated:YES];
            });
        }
        
        self->_tijiaoBtn.enabled = YES;
    } failure:^(NSError *error) {
        self->_tijiaoBtn.enabled = YES;
    }];
}
-(void)shenhetongguo{
    _tijiaoBtn.enabled = NO;
    NSMutableDictionary *dic =[NSMutableDictionary dictionary];
    NSString *str =[NSString stringWithFormat:@"reportputConfirmedReport"];
    NSString *nameStr =@"审核通过";
    [dic setValue:self.zid forKey:@"orderId"];
    [dic setValue:_reporID forKey:@"reportId"];
    [dic setValue:@1 forKey:@"reviewStatus"];
    [dic setValue:my_AppDelegate.token forKey:@"token"];
    
    [NetWorking startPOSTRequestWithUrl:str parameters:dic logMes:nameStr show:YES success:^(NSDictionary *data) {
        self->_tijiaoBtn.enabled = YES;
        NSString *status = [NSString stringWithFormat:@"%@", [data objectForKey:@"status"]];
        if ([status isEqualToString:@"200"]) {
            dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
                
                [self.navigationController popViewControllerAnimated:YES];
            });
        }
    } failure:^(NSError *error) {
        self->_tijiaoBtn.enabled = YES;
    }];
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
